﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using BLL;
using Models;

namespace Workflow.BaoJia
{
    public partial class SearchBaoJia : System.Web.UI.Page
    {
        //private WorkflowManager objWorkflowManager = new WorkflowManager();
        //private BugManager objBugManager = new BugManager();
        private BaojiaManager objBaojiaManager = new BaojiaManager();
        public List<Baojia> resultList = new List<Baojia>();
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {

            }
        }

        protected void BtnSubmit_Click(object sender, EventArgs e)
        {
            try
            {
                string result = objBaojiaManager.GetId(txtNo1.Text.ToUpper().Trim().ToString(), txtNo2.Text.ToUpper().Trim().ToString());
                int a;
                if(!int.TryParse(result.Substring(0,1),out a))
                {
                    string msg = string.Format("<script>alert('{0}')</script>", result);
                    Page.ClientScript.RegisterStartupScript(Page.GetType(), "alert", msg);
                }
                else
                {
                    string[] strId = new string[2];
                    strId = result.Split(',');
                    resultList = objBaojiaManager.GetBaojiaInfo(Convert.ToInt32(strId[0]),Convert.ToInt32(strId[1]),this.ddlCustomer.SelectedValue);
                }
                //resultList = objBugManager.GetAllBugInfo(this.ddlNodeName.SelectedValue, this.ddlPName.SelectedValue, this.ddlMName.SelectedValue);
            }
            catch (Exception ex)
            {
                string msg = string.Format("<script>alert('{0}')</script>", ex.Message);
                Page.ClientScript.RegisterStartupScript(Page.GetType(), "alert", msg);
            }
        }
    }
}